#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5e6 + 5;

int n, m, A;
int a[N], mx[N];
ll sum1[N], sum2[N];
void get_mx(int k) {
  deque<int> dq;
  rep(i, 1, n) {
    while (dq.size() && a[dq.back()] <= a[i]) dq.pop_back();
    dq.push_back(i);
    while (dq.size() && dq.front() + k <= i) dq.pop_front();
    if (i >= k) mx[i + 1 - k] = a[dq.front()];
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> A;
  rep(i, 1, n) cin >> a[i];
  if (m == 1) {
    ll sum = accumulate(a + 1, a + n + 1, 0ll);
    sum += A;
    cout << sum;
    return 0;
  }
  get_mx(m);
  rep(i, 1, n) sum1[i] = sum1[i - 1] + mx[i];
  get_mx(m - 1);
  rep(i, 1, n) sum2[i] = sum2[i - 1] + max(mx[i], A);
  ll tot = sum1[n - m + 1];
  ll ans = tot + sum2[n - m + 2] - sum2[n - m + 1];
  rep(i, 1, n) {
    int l = max(1, i + 1 - m), r = min(i, n + 2 - m);
    ll x = sum2[r] - sum2[l - 1];
    ll y = sum1[r - 1] - sum1[l - 1];
    ll now = tot - y + x;
    ans = max(ans, now);
  }
  cout << ans;
  return 0;
}